0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 0 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 55 ms)
↳10 BOUNDS(1, 1)
first(0, X) → nil
first(s(X), cons(Y)) → cons(Y)
from(X) → cons(X)
first(0, X) → nil [1]
first(s(X), cons(Y)) → cons(Y) [1]
from(X) → cons(X) [1]
first(0, X) → nil [1]
first(s(X), cons(Y)) → cons(Y) [1]
from(X) → cons(X) [1]
first :: 0:s → nil:cons → nil:cons 0 :: 0:s nil :: nil:cons s :: a → 0:s cons :: b → nil:cons from :: b → nil:cons |
first(v0, v1) → null_first [0]
null_first, const, const1
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
0 => 0
nil => 0
null_first => 0
const => 0
const1 => 0
first(z, z') -{ 1 }→ 0 :|: z' = X, X >= 0, z = 0
first(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
first(z, z') -{ 1 }→ 1 + Y :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0
from(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
eq(start(V, V1),0,[first(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[from(V, Out)],[V >= 0]). eq(first(V, V1, Out),1,[],[Out = 0,V1 = X1,X1 >= 0,V = 0]). eq(first(V, V1, Out),1,[],[Out = 1 + Y1,V = 1 + X2,Y1 >= 0,V1 = 1 + Y1,X2 >= 0]). eq(from(V, Out),1,[],[Out = 1 + X3,X3 >= 0,V = X3]). eq(first(V, V1, Out),0,[],[Out = 0,V2 >= 0,V3 >= 0,V = V2,V1 = V3]). input_output_vars(first(V,V1,Out),[V,V1],[Out]). input_output_vars(from(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. non_recursive : [first/3]
1. non_recursive : [from/2]
2. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into first/3
1. SCC is completely evaluated into other SCCs
2. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations first/3
* CE 5 is refined into CE [7]
* CE 4 is refined into CE [8]
* CE 6 is refined into CE [9]
### Cost equations --> "Loop" of first/3
* CEs [7] --> Loop 4
* CEs [8,9] --> Loop 5
### Ranking functions of CR first(V,V1,Out)
#### Partial ranking functions of CR first(V,V1,Out)
### Specialization of cost equations start/2
* CE 2 is refined into CE [10,11]
* CE 3 is refined into CE [12]
### Cost equations --> "Loop" of start/2
* CEs [10,11,12] --> Loop 6
### Ranking functions of CR start(V,V1)
#### Partial ranking functions of CR start(V,V1)
Computing Bounds
=====================================
#### Cost of chains of first(V,V1,Out):
* Chain [5]: 1
with precondition: [Out=0,V>=0,V1>=0]
* Chain [4]: 1
with precondition: [V1=Out,V>=1,V1>=1]
#### Cost of chains of start(V,V1):
* Chain [6]: 1
with precondition: [V>=0]
Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [6] with precondition: [V>=0]
- Upper bound: 1
- Complexity: constant
### Maximum cost of start(V,V1): 1
Asymptotic class: constant
* Total analysis performed in 30 ms.